package com.example.demo.controller;

import com.example.demo.core.Result;
import com.example.demo.entity.Province;
import com.example.demo.service.ProvinceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 地理位置省份信息控制器
 *
 * @author 叮当猫的百宝箱
 * @since 1.0
 */

@Tag(name = "地理位置省份信息", description = "地理位置省份信息")
@RestController
@RequestMapping("/geo")
@RequiredArgsConstructor
public class ProvinceController {
    private final ProvinceService provinceService;

    /**
     * 获取全部省份信息
     *
     * @return API全局响应对象
     */
    @Operation(summary = "获取全部省份信息列表")
    @GetMapping("/province")
    public Result<List<Province>> getProvinceList() {
        List<Province> allProvinces = provinceService.getAllProvinces();
        return Result.ok(allProvinces);
    }
}
